//
//  LMTextViewPlus.m
//  舍品
//
//  Created by 楼 眉 on 16/2/23.
//  Copyright © 2016年 楼 眉. All rights reserved.
//

#import "LMTextViewPlus.h"

@interface LMTextViewPlus ()
@property (nonatomic,strong)  UIButton *leftBtn;
@property (nonatomic,strong)  UIButton *rightBtn;
@end
@implementation LMTextViewPlus
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        UITextView *textView = [[UITextView alloc]init];
        self.textView = textView;
        [self addSubview:textView];
        
        UIButton *leftBtn = [[UIButton alloc]init];
        self.leftBtn = leftBtn;
        [self.leftBtn setTitle:@"拖动" forState:UIControlStateNormal];
        [self addSubview: leftBtn];
        
        UIButton *rightBtn = [[UIButton alloc]init];
        [rightBtn addTarget:self action:@selector(deleteBtnClick) forControlEvents:UIControlEventTouchUpInside];
        self.rightBtn  = rightBtn;
        [self.rightBtn setTitle:@"删除" forState:UIControlStateNormal];
        [self addSubview: rightBtn];
        self.backgroundColor = [UIColor lightGrayColor];
    }
    return self;
}


- (void)layoutSubviews
{
    self.textView.frame = CGRectMake(5, 5, self.width - 10, self.height - 40);
    self.leftBtn.frame = CGRectMake(5, CGRectGetMaxY(self.textView.frame), 50, 30);
    self.rightBtn.frame = CGRectMake(self.width -50,self.leftBtn.y , 50, 30);
}

- (void)deleteBtnClick
{
//    [self removeFromSuperview];
}
@end
